//////////////////////////////////
///生成时间:2012-03-06 10:04:02
///BaseModel:系统用户明细(Sys_UserInfo)(Sys_UserInfo)
//////////////////////////////////
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace yule.Model.Base.Sys
{
    /// <summary>
    /// 系统用户明细(Sys_UserInfo) (Sys_UserInfo)
    /// </summary>
    [DataContract]
    [Serializable]
    public abstract class UserInfo : yule.Model.IModel<yule.Model.Sys.UserInfo>
    {
        #region 属性

        /// <summary>
        /// 主键
        /// </summary>
        private dynamic _Id = null;
        /// <summary>
        /// 主键 char(32)
        /// </summary>
        [DataMember]
        public dynamic Id
        {
            get { return this._Id; }
            set { this._Id = value; }
        }

        /// <summary>
        /// 用户
        /// </summary>
        private string _UserId = null;
        /// <summary>
        /// 用户 char(32)
        /// </summary>
        [DataMember]
        public string UserId
        {
            get { return this._UserId; }
            set { this._UserId = value; }
        }

        /// <summary>
        /// 地址
        /// </summary>
        private string _Address = null;
        /// <summary>
        /// 地址 nvarchar(200)
        /// </summary>
        [DataMember]
        public string Address
        {
            get { return this._Address; }
            set { this._Address = value; }
        }

        /// <summary>
        /// 性别
        /// </summary>
        private int _Sex = int.MinValue;
        /// <summary>
        /// 性别 int
        /// </summary>
        [DataMember]
        public int Sex
        {
            get { return this._Sex; }
            set { this._Sex = value; }
        }

        #endregion

        #region 方法

        /// <summary>
        /// 转化实体
        /// </summary>
        public void Convert(System.Data.DataRow row)
        {
            if (row.Table.Columns.Contains(yule.Model.Sys.UserInfo.Field.Id) == true)
            {
                this.Id = yule.Util.Convert.ToString(row[yule.Model.Sys.UserInfo.Field.Id]);
            }
            if (row.Table.Columns.Contains(yule.Model.Sys.UserInfo.Field.UserId) == true)
            {
                this.UserId = yule.Util.Convert.ToString(row[yule.Model.Sys.UserInfo.Field.UserId]);
            }
            if (row.Table.Columns.Contains(yule.Model.Sys.UserInfo.Field.Address) == true)
            {
                this.Address = yule.Util.Convert.ToString(row[yule.Model.Sys.UserInfo.Field.Address]);
            }
            if (row.Table.Columns.Contains(yule.Model.Sys.UserInfo.Field.Sex) == true)
            {
                this.Sex = yule.Util.Convert.ToInt(row[yule.Model.Sys.UserInfo.Field.Sex]);
            }
        }

        public static yule.Model.Sys.UserInfo Select(dynamic id)
        {

            yule.Model.Sys.UserInfo model = yule.Common.CacheManager.Cache.Get<yule.Model.Sys.UserInfo>(id);

            if (model == null)
            {
                model = yule.Common.ServiceManager.ServiceContext.CreateService<yule.IDAL.Sys.IUserInfo>().Select(id);
            }

            return model;
        }

        #endregion

        #region 表

        /// <summary>
        /// 表
        /// </summary>
        public struct Table
        {
            /// <summary>
            /// 表名
            /// </summary>
            public const string Name = "Sys_UserInfo";
        }

        #endregion

        #region 字段

        /// <summary>
        /// 字段
        /// </summary>
        public struct Field
        {
            /// <summary>
            /// 主键
            /// </summary>
            public const string Id = "Id";
            /// <summary>
            /// 用户
            /// </summary>
            public const string UserId = "UserId";
            /// <summary>
            /// 地址
            /// </summary>
            public const string Address = "Address";
            /// <summary>
            /// 性别
            /// </summary>
            public const string Sex = "Sex";
        }

        #endregion

        #region 属性

        /// <summary>
        /// 属性
        /// </summary>
        public struct Property
        {
            /// <summary>
            /// 主键
            /// </summary>
            public const string Id = "Id";
            /// <summary>
            /// 用户
            /// </summary>
            public const string UserId = "UserId";
            /// <summary>
            /// 地址
            /// </summary>
            public const string Address = "Address";
            /// <summary>
            /// 性别
            /// </summary>
            public const string Sex = "Sex";
        }

        #endregion

    }
}